package com.stxx.stiot2.service.tran;

import com.stxx.framwork.domain.model.Option;
import com.stxx.framwork.tran.TranService;
import com.stxx.framwork.utils.StoreUtils;
import com.stxx.stiot2.service.SysConfigService;
import org.noear.solon.annotation.Component;
import org.noear.solon.annotation.Inject;
import org.noear.solon.data.sql.SqlBuilder;

import java.sql.SQLException;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
public class AssetTypeTranService implements TranService {
    @Inject
    SysConfigService configService;
    @Override
    public Map<String, Map<String, Object>> tran(String fieldName, Collection<String> ids) {
        Map<String, Map<String,Object>> map = new HashMap<>();

            List<Option> options = configService.options(SysConfigService.Keys.asset_type);
            options.forEach(item->{
                Map<String,Object> tranMap = new HashMap<>();
                tranMap.put(fieldName,item.getLabel());
                map.put(item.getValue(),tranMap);
            });

        return map;
    }
}
